package com.apobates.forum.toro;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collection;
import java.util.function.Supplier;

/**
 * 抽像映射器
 * @param <E> 目标对象Class
 * @param <T> 初始对象类型
 */
public abstract class AbstractMapper<E,T> {
    private final Supplier<Collection<T>> origin;
    /**
     * 目标对象Class
     * 例: OrdersVo.class
     */
    private final Class<E> className;
    /**
     * 是否并发执行
     * true并发,false串行
     */
    private final boolean concurrent;
    private final boolean many;

    private static final Logger logger = LoggerFactory.getLogger(AbstractMapper.class);

    public AbstractMapper(Supplier<Collection<T>> origin, Class<E> className, boolean isConcurrent, boolean isMany) {
        this.origin = origin;
        this.className = className;
        this.concurrent = isConcurrent;
        this.many = isMany;
    }

    public Supplier<Collection<T>> getOrigin() {
        return origin;
    }

    public Class<E> getClassName() {
        return className;
    }

    public boolean isConcurrent() {
        return concurrent;
    }

    public boolean isMany() {
        return many;
    }
}
